home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
general
/
raytrace
/
rayshade
/
graphtal.lzh
/
Graphtal.Amiga
/
Polygon.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-17
|
1KB
|
60 lines
/*
* Polygon.h - class definition for polygon handling.
*
* Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
* University of Berne, Switzerland
* All rights reserved.
*
* This software may be freely copied, modified, and redistributed
* provided that this copyright notice is preserved on all copies.
*
* You may not distribute this software, in whole or in part, as part of
* any commercial product without the express consent of the authors.
*
* There is no warranty or other guarantee of fitness of this software
* for any purpose. It is provided solely "as is".
*
*/
#ifndef Polygon_H
# define Polygon_H
#include "Vector.h"
#include "TransMatrix.h"
#include "list.h"
declareList(VertexList, Vector);
class Polygon
{
public:
Polygon(long size = 100);
Polygon(const Vector&, const Vector&, const Vector&);
Polygon(const Vector&, const Vector&, const Vector&, const Vector&);
Polygon(const Polygon&);
~Polygon();
void transform(const TransMatrix&);
const Vector& normal() const;
void addVertex(const Vector&);
void removeVertex(long);
long numVertices() const;
const Vector& vertex(long) const;
private:
VertexList* vertices;
};
typedef Polygon* PolygonPtr;
declareList(PolygonList, PolygonPtr);
inline long Polygon::numVertices() const {
return vertices->count();
}
inline const Vector& Polygon::vertex(long index) const {
return vertices->item(index);
}
#endif // Polygon_H